# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=emacs-f
pkgver=0.21.0
pkgrel=0
_pkgreal=f
pkgdesc="Modern API for working with files and directories in Emacs"
url="https://github.com/rejeep/f.el"
arch="noarch"
license="GPL-3.0-or-later"
depends="
	cmd:emacs
	emacs-dash
	emacs-s
	"
makedepends="emacs-nox"
source="https://github.com/rejeep/f.el/archive/v$pkgver/emacs-f-$pkgver.tar.gz"
builddir="$srcdir/f.el-$pkgver"
options="!check" # tests require unpackaged "undercover"

build() {
	emacs -batch -q -no-site-file -L . \
		-eval '(setq byte-compile-error-on-warn t)' \
		-f batch-byte-compile \
		./*.el
}

check() {
	emacs -batch -q -no-site-file -L . -L test \
		-l f-init -f ert-run-tests-batch-and-exit
}

package() {
	install -Dvm644 ./*.el ./*.elc \
		-t "$pkgdir"/usr/share/emacs/site-lisp/

	cd "$pkgdir"/usr/share/emacs/site-lisp
	emacs -batch -q -no-site-file \
		-eval "(loaddefs-generate \".\" \"$_pkgreal-loaddefs.el\")"
}

sha512sums="
4cb43b31115797064d1de1e92adf6a596555881a066fc832a5d8acfa397534484ae7566609b87f48dfb2499b9972cdb60ea7b37f953dfcee333939e5b2f96ec3  emacs-f-0.21.0.tar.gz
"
